<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>成绩百分制转换为五级制</title>
		<style type="text/css">
			#div1 {
				width: 300px;
				height: 300px;
				background-color: #006600;
				margin: 100px auto;
				color: white;
				font-size: 24px;
				border: 8px double #009933;
				text-align: center;
			}
		</style>
	</head>
	<body>
		<div id="div1">
			<script type="text/javascript">
				document.write("<strong>课程成绩评定</strong><br><br>");
				var result = "";
				var x = prompt("请输入你的成绩：", 0);
				if (x != null) {
					document.write("课程成绩为：" + x + "分");
					if (x >= 90) {
						result = "优秀";
						alert("1——成绩等级为" + result);
					} else if (x >= 80) {
						result = "良好";
						alert("2——成绩等级为" + result);
					} else if (x >= 70) {
						result = "中等";
						alert("3——成绩等级为" + result);
					} else if (x >= 60) {
						result = "合格";
						alert("4——成绩等级为" + result);
					} else {
						result = "不合格";
						alert("5——成绩等级为" + result);
					}
				} else {
					alert("请重新输入成绩！");
				}
				document.write("<br>成绩等级为：" + result);
			</script>
		</div>
	</body>
</html>

